﻿using Emoney.UserTraining.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NHibernate.Linq;

namespace Emoney.UserTraining.DAL
{
   public class Web_TrainPlaceDAL
    {
       public List<Web_TrainPlace> GetList(Web_TrainPlaceQuery c)
       {
           DateTime now = DateTime.Now;
           DateTime d1 = new DateTime(now.Year, now.Month, 1);
           DateTime d2 = d1.AddMonths(1).AddDays(-1);
           using (EMweb_newContext context = new EMweb_newContext())
           {
               var query = from a in context.web_TrainPlaceS
                           from b in context.web_TrainUserS
                           where a.place_num == b.place_num && b.username == c.UserName && b.addtime >= d1 && b.addtime <= d2
                           select a;
               return query.Cacheable().ToList();
           }
       }

    }
}
